import request from '@/utils/request';

/**
 * 2.13.1 redis池查询 /coupon-config/redispool/search
 */
export async function redispoolSearch(data: API.RedispoolInfo, options?: API.baseOption) {
  return request<API.BasePaginationRes<API.RedispoolListItem>>('/redispool/search', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.13.2 redis池编辑 /coupon-config/redispool/edit
 */
export async function redispoolEdit(
  data: Partial<API.RedispoolListItem>,
  options?: API.baseOption,
) {
  return request<any>('/redispool/edit', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.13.3 redis数据查询 /coupon-config/redispool/data-search
 */
export async function redispoolDataSearch(
  data: { key: string; server: number },
  options?: API.baseOption,
) {
  return request<any>('/redispool/data-search', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.13.4 redis池详情 /coupon-config/redispool/detail
 */
export async function redispoolDetail(data: { id: string }, options?: API.baseOption) {
  return request<any>('/redispool/detail', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.20.1 任务查询 /coupon-config/primeextend/search
 */
export async function primeextendSearch(
  data: { placeCardActivityId: string; dealStatus: string },
  options?: API.baseOption,
) {
  return request<API.BasePaginationRes<API.PrimeextendListItem>>('/primeextend/search', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.20.2 任务明细/coupon-config/primeextend/detail
 */
export async function primeextendDetail(data: { id: string }, options?: API.baseOption) {
  return request<any>('/primeextend/detail', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.20.2 任务编辑/coupon-config/primeextend/detail
 */
export async function primeextendEdit(
  data: Partial<API.PrimeextendListItem>,
  options?: API.baseOption,
) {
  return request<any>('/primeextend/edit', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.20.5 任务执行 /coupon-config/primeextend/execute
 */
export async function primeextendExecute(data: { id: string }, options?: API.baseOption) {
  return request<any>('/primeextend/execute', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.14.1 redis站点列表查询 /coupon-config/redischange/site-list
 */
export async function querySiteList(data: any, options?: API.baseOption) {
  return request<any>('/redischange/site-list', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.14.2 redis切换任务查询 /coupon-config/redischange/search
 */
export async function redischangeSearch(
  data: { fromsite: string; pageNo: string; pageSize: string },
  options?: API.baseOption,
) {
  return request<API.BasePaginationRes<API.RedischangeListItem>>('/redischange/search', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.14.3 redis切换任务保存 /coupon-config/redischange/save
 */
export async function redischangeSave(
  data: { fromsite: string; tosite: string; changecluster: string },
  options?: API.baseOption,
) {
  return request<any>('/redischange/save', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.14.4 redis切换任务执行 /coupon-config/redischange/execute
 */
export async function redischangeExecute(
  data: { fromsite?: string; tosite?: string; changecluster?: string; id?: string },
  options?: API.baseOption,
) {
  return request<any>('/redischange/execute', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.14.5 prime数据恢复 /coupon-config/primedata/reset
 */
export async function primedataReset(data: any, options?: API.baseOption) {
  return request<any>('/primedata/reset', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.15.1 刷新任务查询 /coupon-config/cachetask/search
 */
export async function cachetaskSearch(data: any, options?: API.baseOption) {
  return request<any>('/cachetask/search', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.15.2 刷新任务新增 /coupon-config/cachetask/edit
 */
export async function cachetaskEdit(data: any, options?: API.baseOption) {
  return request<any>('/cachetask/edit', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}
